package com.hangjiang.gulidear.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;

/**
 * Project entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "project", catalog = "sqm")
public class Project extends BaseEntity {

	// Fields

	private String projectId;
	private User user;
	private String projName;
	private String projShortName;
	private Date projCtimte;
	private Set<Comment> comments = new HashSet<Comment>(0);
	private Set<ExtraWorkApplication> extraworkapplications = new HashSet<ExtraWorkApplication>(
			0);
	private Set<ConfigItem> configitems = new HashSet<ConfigItem>(0);
	private Set<Bug> bugs = new HashSet<Bug>(0);
	private Set<ConfigChange> configchanges = new HashSet<ConfigChange>(0);
	private Set<ConfigIssue> configissues = new HashSet<ConfigIssue>(0);
	private Set<BaseLine> baselines = new HashSet<BaseLine>(0);
	private Set<Problem> problems = new HashSet<Problem>(0);
	private Set<Code> codes = new HashSet<Code>(0);
	private Set<Task> tasks = new HashSet<Task>(0);

	private Set<UserRole> userRoles = new HashSet<UserRole>(0);

	// Constructors

	/** default constructor */
	public Project() {
	}

	/** full constructor */
	public Project(User user, String projName, String projShortName,
			Date projCtimte) {
		this.user = user;
		this.projName = projName;
		this.projShortName = projShortName;
		this.projCtimte = projCtimte;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "projectId", unique = true, nullable = false, length = 32)
	public String getProjectId() {
		return this.projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "projName", length = 50)
	public String getProjName() {
		return this.projName;
	}

	public void setProjName(String projName) {
		this.projName = projName;
	}

	@Column(name = "projShortName", length = 50)
	public String getProjShortName() {
		return this.projShortName;
	}

	public void setProjShortName(String projShortName) {
		this.projShortName = projShortName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "projCTimte", length = 0)
	public Date getProjCtimte() {
		return this.projCtimte;
	}

	public void setProjCtimte(Date projCtimte) {
		this.projCtimte = projCtimte;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<ExtraWorkApplication> getExtraworkapplications() {
		return this.extraworkapplications;
	}

	public void setExtraworkapplications(
			Set<ExtraWorkApplication> extraworkapplications) {
		this.extraworkapplications = extraworkapplications;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<ConfigItem> getConfigitems() {
		return this.configitems;
	}

	public void setConfigitems(Set<ConfigItem> configitems) {
		this.configitems = configitems;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<Bug> getBugs() {
		return this.bugs;
	}

	public void setBugs(Set<Bug> bugs) {
		this.bugs = bugs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<ConfigChange> getConfigchanges() {
		return this.configchanges;
	}

	public void setConfigchanges(Set<ConfigChange> configchanges) {
		this.configchanges = configchanges;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<ConfigIssue> getConfigissues() {
		return this.configissues;
	}

	public void setConfigissues(Set<ConfigIssue> configissues) {
		this.configissues = configissues;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<BaseLine> getBaselines() {
		return this.baselines;
	}

	public void setBaselines(Set<BaseLine> baselines) {
		this.baselines = baselines;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<Problem> getProblems() {
		return this.problems;
	}

	public void setProblems(Set<Problem> problems) {
		this.problems = problems;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<Code> getCodes() {
		return this.codes;
	}

	public void setCodes(Set<Code> codes) {
		this.codes = codes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<Task> getTasks() {
		return this.tasks;
	}

	public void setTasks(Set<Task> tasks) {
		this.tasks = tasks;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "project")
	public Set<UserRole> getUserRoles() {
		return this.userRoles;
	}

	public void setUserRoles(Set<UserRole> userRoles) {
		this.userRoles = userRoles;
	}

}